﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ThePushCSharp
{
    public class Camera
    {
        public int x;
        public int y;
        public Map map;

        public Camera(Map map)
        {
            x = 0;
            y = 0;
            this.map = map;
        }

        public bool moveTo(int newX, int newY)
        {
            if (newX >= 0 && newX < map.mapWidth)
            {
                if (newY >= 0 && newY < map.mapHeight)
                {
                    x = newX;
                    y = newY;
                    return true;
                }
            }

            return false;
        }

        public bool moveRight()
        {
            if (x < map.mapWidth)
            {
                x++;
                return true;
            }

            return false;
        }

        public bool moveLeft()
        {
            if (x > 0)
            {
                x--;
                return true;
            }

            return false;
        }

        public bool moveDown()
        {
            if (y < map.mapHeight)
            {
                y++;
                return true;
            }

            return false;
        }

        public bool moveUp()
        {
            if (y > 0)
            {
                y--;
                return true;
            }

            return false;
        }
    }
}
